package cn.jiyun.service.impl;

import cn.jiyun.mapper.ConstactorMapper;
import cn.jiyun.mapper.DeveloperMapper;
import cn.jiyun.mapper.ProjectMapper;
import cn.jiyun.pojo.Constactor;
import cn.jiyun.result.QueryPageBean;
import cn.jiyun.service.ConstactorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;


@Service
public class ConstactorServiceimpl implements ConstactorService {

    @Autowired
    private ConstactorMapper constactorMapper;

    @Autowired
    private DeveloperMapper developerMapper;

    @Autowired
    private ProjectMapper projectMapper;


    @Override
    public List<Map> findPage(QueryPageBean queryPageBean) {
        List<Map> list = constactorMapper.findPage((queryPageBean.getCurrentPage() - 1) * queryPageBean.getPageSize(), queryPageBean.getPageSize(), queryPageBean.getQueryString());
        return list;
    }

    @Override
    public int jilu() {
        return constactorMapper.jilu();
    }

    @Override
    public int add(Constactor constactor) {
        constactor.setUpdatetime(new Date());
        return constactorMapper.add(constactor);
    }

    @Override
    public void delete(Integer cid) {
        constactorMapper.delete(cid);
    }

    @Override
    public List<Constactor> findById(Integer cid) {
        return constactorMapper.findById(cid);
    }

    @Override
    public int edit(Constactor constactor) {
        return constactorMapper.edit(constactor);
    }

    /*@Transactional
    @Override
    public long flag(Developer developer, int[] ids) {
        String did = developer.getDid();
        long a = 0L;
        for (int pid : ids) {
            int i = constactorMapper.flag(did, pid);
            a++;
        }
        return a;
    }*/
}
